import { Map } from "immutable"
import * as actionTypes from "./constants"
const defaultState = Map({
    topList: [],
    topListIndex: 0,
    playListDetail: {}
})

export default function reducer(state = defaultState, action) {
    switch (action.type) {
        case actionTypes.CHANGE_TOPLIST:
            return state.set("topList", action.topList)
        case actionTypes.CHANGR_TOPLIST_INDEX:
            return state.set("topListIndex", action.topListIndex)
        case actionTypes.CHANGE_PLAYLIST_DETAIL:
            return state.set("playListDetail", action.playListDetail)
        default:
            return state
    }
}